<?php $this->load->view('common/header');?>

<body>
<?php $this->load->view('common/user_center');?>
<div class="main_box">
    <?php $this->load->view('common/menu');?>
    <div class="right_box f_r">
        <div class="title">
        	<span class="f_l">实名认证</span>
        </div>
        <div class="ifrom_list">
            <dl>
            	<dt>姓名：</dt>
                <dd>
                	<span class="input">
                    	<input id="user_uname" name="user_uname" placeholder="请输入真实姓名" value="<?php echo $user['user_uname'];?>">
                    </span>
                </dd>
            </dl>
            <dl>
            	<dt>身份证号：</dt>
                <dd>
                	<span class="input">
                    	<input id="user_card" name="user_card" placeholder="请输入身份证号码" value="<?php echo $user['user_card'];?>">
                    </span>
                </dd>
            </dl>
            <dl>
            	<dt>上传身份证：</dt>
                <dd>
                	<a href="javascript:;" class="photo a_upload">
                    	<input type="file">
                        <?php if(file_exists(FCPATH.'uploads/card/'.$user['user_id'].'/a_pic.jpg')){?>
                            <img src="<?php echo base_url('uploads/card/'.$user['user_id'].'/a_pic.jpg?t='.time());?>">
                        <?php }else{ ?>
                            <span>
                                身份证<br>正面
                            </span>
                        <?php }?>

                    </a>
                	<a href="javascript:;" class="photo b_upload">
                    	<input type="file">
                        <?php if(file_exists(FCPATH.'uploads/card/'.$user['user_id'].'/b_pic.jpg')){?>
                            <img src="<?php echo base_url('uploads/card/'.$user['user_id'].'/b_pic.jpg?t='.time());?>">
                        <?php }else{ ?>
                            <span>
                                身份证<br>反面
                            </span>
                        <?php }?>

                    </a>
                </dd>
            </dl>
            <dl>
            	<dt>个人征信：</dt>
                <dd>
                	<a  href="javascript:;" class="photo c_upload">
                    	<input type="file">
                        <?php if(file_exists(FCPATH.'uploads/card/'.$user['user_id'].'/c_pic.jpg')){?>
                            <img src="<?php echo base_url('uploads/card/'.$user['user_id'].'/c_pic.jpg?t='.time());?>">
                        <?php }else{ ?>
                            <span>
                                上传<br>征信报告
                            </span>
                        <?php }?>
                    </a>
                </dd>
            </dl>
            <dl>
            	<dt>对公账号流水：</dt>
                <dd>
                	<a  href="javascript:;" class="photo d_upload">
                    	<input type="file">
                        <?php if(file_exists(FCPATH.'uploads/card/'.$user['user_id'].'/d_pic.jpg')){?>
                            <img src="<?php echo base_url('uploads/card/'.$user['user_id'].'/d_pic.jpg?t='.time());?>">
                        <?php }else{ ?>
                            <span>
                                上传<br>公账流水
                            </span>
                        <?php }?>

                    </a>
                </dd>
            </dl>
            <dl>
            	<dt>&nbsp;</dt>
                <dd>
                    <?php if(in_array($user['user_card_rz'],[0,3])){?>
                        <a href="javascript:;"  class="nav sure_ok">提交认证</a>
                    <?php }?>

                </dd>
            </dl>
        </div>
    </div>
</div>
<?php if($user['user_card_rz']<2){?>
    <script src="<?php echo $viewmulu;?>js/jquery.core.image.upload.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var uid = "<?php echo $user['user_id'];?>";
            $(".a_upload").coreImageUpload ({
                url: baseurl+'index.php/upload/upload_card?uid='+uid+'&name=a_pic',
                inputOfFile: 'a_pic',
                uploadedCallback: function (result) {
                    if(result.status==1){
                        var img = '<img src="'+result.url+'">';
                        $(".a_upload img").remove();
                        $(".a_upload span").remove();
                        $(".a_upload").html(img);
                    }else{
                        layer.msg(result.msg,{offset:"80px"});
                    }
                }
            });
            $(".b_upload").coreImageUpload ({
                url: baseurl+'index.php/upload/upload_card?uid='+uid+'&name=b_pic',
                inputOfFile: 'b_pic',
                uploadedCallback: function (result) {
                    if(result.status==1){
                        var img = '<img src="'+result.url+'">';
                        $(".b_upload img").remove();
                        $(".a_upload span").remove();
                        $(".b_upload").html(img);
                    }else{
                        layer.msg(result.msg,{offset:"80px"});
                    }
                }
            });
            $(".c_upload").coreImageUpload ({
                url: baseurl+'index.php/upload/upload_card?uid='+uid+'&name=c_pic',
                inputOfFile: 'c_pic',
                uploadedCallback: function (result) {
                    if(result.status==1){
                        var img = '<img src="'+result.url+'">';
                        $(".c_upload img").remove();
                        $(".a_upload span").remove();
                        $(".c_upload").html(img);
                    }else{
                        layer.msg(result.msg,{offset:"80px"});
                    }
                }
            });
            $(".d_upload").coreImageUpload ({
                url: baseurl+'index.php/upload/upload_card?uid='+uid+'&name=d_pic',
                inputOfFile: 'd_pic',
                uploadedCallback: function (result) {
                    if(result.status==1){
                        var img = '<img src="'+result.url+'">';
                        $(".d_upload img").remove();
                        $(".a_upload span").remove();
                        $(".d_upload").html(img);
                    }else{
                        layer.msg(result.msg,{offset:"80px"});
                    }
                }
            });
        });
    </script>
    <script type="text/javascript">
        $(".sure_ok").click(function(){
            var user_uname = $("#user_uname").val();
            var user_card = $("#user_card").val();
            if(user_uname.length ==0){
                layer.msg("真实姓名不能为空",{offset:"80px"});
                return false;
            }
            if(user_card.length ==0){
                layer.msg("身份证号不能为空",{offset:"80px"});
                return false;
            }
            $.ajax({
                type : "post",
                url: baseurl+"index.php/member/verified",
                data: {'user_uname':user_uname,'user_card':user_card,'csrf_test_name': ci_csrf_token()},
                dataType:"JSON",
                success: function (msg) {
                    if(msg.status==1){
                        layer.msg(msg.info, {
                            time: 1000, //1s后自动关闭
                            shade: 0.1
                        },function () {
                            window.location.href=window.location.href;
                        });
                    }else{
                        layer.msg(msg.info);
                        return false;
                    }
                }
            })
        });
    </script>
<?php }?>
<!--]] user -->
<!-- coypright [[-->
<?php $this->load->view('common/footer');?>
<!--]] coypright -->
</body>
</html>
